<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ENZO后台—文章列表</title>
<%@include file="/WEB-INF/view/common/css.jsp"%>
<%@include file="/WEB-INF/view/common/systemcss.jsp"%>
<style type="text/css">
.sear {
	margin: 10px 0 2px 10px;
}

table thead {
	margin-top: 35px;
	background-color: #d1c7b7;
}
</style>
<script type="text/javascript">
	$(function() {
		//tip 进行初始化
		$('[data-toggle="tooltip"]').tooltip();
		$(".addartice").click(function() {
			
			
			layer.open({
				type : 2,
				title : '很多时候，我们想最大化看，比如像这个页面。',
				shadeClose : true,
				shade : false,
				maxmin : true, //开启最大化最小化按钮
				area : [ '893px', '600px' ],
				content : '<en:path/>/system/ArticleToAdd.html',
				btn : [ '保存', '取消' ],
				yes : function(index, layero) {
				    var body = layer.getChildFrame('body', index);
				    $.ajax({
				    	url:'<en:path/>/system/ArticleSave.do',
				    	type:'post',
				    	data:body.find("#articeadfaskfdklasdform:first").serialize(),
				    	success:function(){
				    		window.location.reload();
				    		layer.close(index);
				    	}
				    });
				},
				cencel : function(index) {
					alert(index)
				}
			})
		});
	});
	
	function deleteArticle(index){
		layer.confirm('是否要进行删除',{icon: 3, title:'提示'},function(aa){
			$.ajax({
		    	url:'<en:path/>/system/ArticleDelete.do',
		    	type:'post',
		    	data:{"id":index},
		    	success:function(){
		    		window.location.reload();
		    	}
		    });
			  layer.close(aa);
		});
		
		
	}
</script>
</head>
<body>
	<%@include file="/WEB-INF/view/common/system/header.jsp"%>
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
		<div class="row ">
			<ol class="breadcrumb">
				<li><a href='<en:path/>/system/main.html'><span
						class="glyphicon glyphicon-home"></span></a></li>
				<li class="active">文章列表</li>
			</ol>
		</div>

		<div class="row sear">
			<div class="form-inline">
				上级菜单 ：<select class="form-control">
					<c:forEach items="${list }" var="nav">
						<option value="${nav.id }">${nav.name }</option>
					</c:forEach>
				</select> <input class="form-control" placeholder="文章名">
				<button type="button" class="btn btn-primary">搜索</button>
				<button type="button" class="btn btn-primary addartice">添加文章</button>
			</div>
		</div>
		<table class="table table-striped">
			<thead>
				<tr>
					<th>父菜单
					<th>标题
					<th>浏览量
					<th>修改时间
					<th>创建时间
					<th>排序
					<th>发布者
					<th>操作
				</tr>
			</thead>
			<c:forEach items="${pagehelper.list }" var="art">
				<tr>
					<td>${art.navname}
					<td><a href="<en:path/>${art.path }" target="_blank">${art.title }</a>
					<td>${art.countview }
					<td>${art.updatetime}
					<td>${art.createtime}
					<td>${art.sort }
					<td>${art.publishUserid }
					<td><a  class="" href="#"  data-toggle="tooltip" title="删除" onclick="deleteArticle('${art.id}')">删除</a>
				</tr>
			</c:forEach>
		</table>
		<%@include file="/WEB-INF/view/common/pagehelper.jsp"%>
	</div>


	<%@include file="/WEB-INF/view/common/system/footer.jsp"%>
</body>
</html>